<template>
  <div class="page">
    <div class="s-search p20">
      <el-form
        :model="alone.searchForm.data"
        status-icon
        ref="ruleForm"
        :inline="true"
        class="demo-ruleForm"
      >
        <el-form-item>
          <el-input
            placeholder="请输入昵称/微信号搜索"
            v-model="alone.searchForm.data.searchStr"
          >
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-select
            v-model="alone.searchForm.data.signWish"
            placeholder="请选择签约意愿搜索"
          >
            <el-option
              v-for="item in $store.state.SIGN.WISH.list"
              :key="item.value"
              :label="item.name"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <!-- <el-form-item>
          <el-select
            v-model="alone.searchForm.data.platform"
            placeholder="请选择意向平台搜索"
          >
            <el-option
              v-for="item in $store.state.platformList"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item> -->
        <el-form-item>
          <el-cascader
            v-model="alone.searchForm.data.platform"
            :props="orgCascaderCp.config.props"
            :options="orgSupAjax.data"
            placeholder="请选择意向平台搜索"
          >
          </el-cascader>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="rSubmitSearchForm">搜索</el-button>
        </el-form-item>
      </el-form>
    </div>

    <div class="c-main p20">
      <div class="c-aside clearfix">
        <el-button
          type="primary"
          class="fr btn"
          @click="rToUrl"
          v-hasAuth:seestar_create
          >新增</el-button
        >
      </div>
      <div class="c-section">
        <div class="c-body">
          <el-table :data="pageAjax.data" stripe style="width: 100%">
            <el-table-column label="头像" width="130">
              <template slot-scope="scope">
                <!-- <img class="c-avatar" :src="scope.row.avatarUrl" alt="" /> -->
                <el-image
                  class="c-avatar"
                  :src="scope.row.avatarUrl"
                  fit="cover"
                ></el-image>
              </template>
            </el-table-column>
            <el-table-column prop="nickName" label="昵称">
              <template slot-scope="scope">
                <div class="">
                  {{ scope.row.nickName }}
                  <span v-if="scope.row.hasLiveExperience" class="text-warning"
                    >(有直播经验)</span
                  >
                  <span v-else>(无直播经验)</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column label="微信号">
              <template slot-scope="scope">
                <div class="">
                  {{ scope.row.wxNo || "无" }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="联系电话">
              <template slot-scope="scope">
                <div class="">
                  {{ scope.row.contractPhone || "无" }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="来源">
              <template slot-scope="scope">
                <div class="">
                  <span v-if="scope.row.source === 0">
                    <template v-if="scope.row.onlineType == 'ONLINE'">
                      线上
                    </template>
                    <template v-else>
                      线下{{
                        scope.row.channelName
                          ? "(" + scope.row.channelName + ")"
                          : ""
                      }}
                    </template>
                  </span>
                  <span v-else-if="scope.row.source === 1">
                    星探{{
                      scope.row.scoutName ? "(" + scope.row.scoutName + ")" : ""
                    }}
                  </span>
                  <span v-else>
                    联营{{
                      scope.row.unionName ? "(" + scope.row.unionName + ")" : ""
                    }}
                  </span>
                </div>
              </template>
            </el-table-column>
            <el-table-column label="意向平台">
              <template slot-scope="scope">
                <div class="text-abbreviate">
                  {{ scope.row.intentionPlatform || "无" }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="期望待遇">
              <template slot-scope="scope">
                <div class="">
                  {{
                    getSalaryStr(
                      scope.row.expectedBaseSalary,
                      scope.row.expectedBottomGuard,
                      scope.row.expectedSigningBonus,
                      scope.row.expectedOther
                    ) || "无"
                  }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="签约意愿">
              <template slot-scope="scope">
                <div class="">
                  {{
                    $store.state.SIGN.WISH.translate[scope.row.signWish] || "无"
                  }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="签约状态">
              <template slot-scope="scope">
                <div class="">
                  {{
                    $store.state.SIGN.STATUS.translate[scope.row.signStatus] ||
                      "无"
                  }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="操作" width="250">
              <template slot-scope="scope">
                <el-button
                  type="text"
                  size="small"
                  v-hasAuth:seestar_detail
                  @click="navToDetail(scope.row.anchorId)"
                  >详情</el-button
                >
                <el-button
                  type="text"
                  size="small"
                  v-hasAuth:seestar_edit
                  @click="navToEdit(scope.row.anchorId)"
                  >修改</el-button
                >
                <el-button
                  type="text"
                  size="small"
                  v-hasAuth:seestar_actorRecord
                  @click="rRecord(scope.row.anchorId)"
                  >跟进记录</el-button
                >
                <el-button
                  type="text"
                  size="small"
                  v-hasAuth:seestar_actorStatusChange
                  @click="
                    rChangeStatus(scope.row.anchorId, scope.row.signStatus)
                  "
                  >更改状态</el-button
                >
                <el-button
                  type="text"
                  size="small"
                  v-hasAuth:seestar_actorWishChange
                  @click="rChangeWish(scope.row.anchorId, scope.row.signWish)"
                  >更改意愿</el-button
                >
                <el-button
                  type="text"
                  size="small"
                  v-hasAuth:seestar_delete
                  @click="rDeleteActor(scope.row.anchorId)"
                  >删除</el-button
                >
                <el-button
                  type="text"
                  size="small"
                  v-hasAuth:seestar_pageView
                  @click="getPageView(scope.row)"
                  >浏览记录</el-button
                >
                <span
                  v-hasAuth:seestar_detail-seestar_edit-seestar_delete-seestar_actorRecord-seestar_actorStatusChange-seestar_pageView-seestar_actorWishChange.invert
                  >—</span
                >
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div class="c-footer">
          <div class="c-pagination">
            <el-pagination
              layout="prev, pager, next"
              @current-change="rPagingChange"
              @prev-click="rPagingChange"
              @next-click="rPagingChange"
              :current-page="pageAjax.paging.current"
              :total="pageAjax.paging.total"
            >
            </el-pagination>
          </div>
        </div>
      </div>
    </div>
    <!-- recordDrawerCp -->
    <el-drawer
      :title="recordDrawerCp.config.title"
      :visible.sync="recordDrawerCp.config.visible"
      :direction="recordDrawerCp.config.direction"
      :size="recordDrawerCp.config.size"
    >
      <div class="f-record">
        <div class="c-content">
          <el-row class="">
            <el-col :span="14" :offset="5">
              <el-form ref="record" label-width="80px">
                <el-form-item label="跟进记录">
                  <el-input
                    type="textarea"
                    v-model="recordDrawerCp.data.record"
                  ></el-input>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="rSubmitRecordForm"
                    >提交</el-button
                  >
                </el-form-item>
              </el-form>
              <div class="c-main">
                <el-table :data="recordAjax.data" style="width: 100%">
                  <el-table-column prop="createTime" label="时间" width="150">
                  </el-table-column>
                  <el-table-column prop="followUp" label="内容">
                  </el-table-column>
                </el-table>
              </div>
            </el-col>
          </el-row>
        </div>
      </div>
    </el-drawer>
    <!-- 浏览记录 -->
    <el-drawer :visible.sync="pageView.visible" direction="ttb" size="700px">
      <div class="f-record">
        <el-row class="">
          <el-col :span="18" :offset="3">
            <div class="c-main">
              <el-table :data="pageView.list" style="width: 100%" height="500">
                <el-table-column label="头像" width="150">
                  <template slot-scope="scope">
                    <el-image
                      class="c-avatar"
                      :src="scope.row.userView.avatarUrl"
                      fit="cover"
                    ></el-image>
                  </template>
                </el-table-column>
                <el-table-column label="昵称">
                  <template slot-scope="scope">
                    {{ scope.row.userView.nickName }}
                  </template>
                </el-table-column>
                <el-table-column prop="followUp" label="姓名">
                  <template slot-scope="scope">
                    {{ scope.row.userView.realName }}
                  </template>
                </el-table-column>
                <el-table-column prop="followUp" label="部门">
                  <template slot-scope="scope">
                    {{ scope.row.userView.departmentName }}
                  </template>
                </el-table-column>
                <el-table-column prop="userAgent" label="负责的平台">
                  <template slot-scope="scope">
                    {{ scope.row.userView.platformName }}
                  </template>
                </el-table-column>
                <el-table-column prop="userAgent" label="浏览方式">
                </el-table-column>
                <el-table-column prop="createTime" label="浏览时间" width="180">
                </el-table-column>
              </el-table>
              <div class="c-footer">
                <div class="c-pagination">
                  <el-pagination
                    layout="prev, pager, next"
                    @current-change="getPageViewData"
                    :current-page="pageView.pageNo"
                    :total="pageView.total"
                  >
                  </el-pagination>
                </div>
              </div>
            </div>
          </el-col>
        </el-row>
      </div>
    </el-drawer>
    <!-- statusDrawerCp -->
    <el-drawer
      :title="statusDrawerCp.config.title"
      :visible.sync="statusDrawerCp.config.visible"
      :direction="statusDrawerCp.config.direction"
    >
      <el-row class="f-status">
        <el-col :span="8" :offset="8">
          <el-form ref="status" label-width="80px">
            <el-form-item label="签约状态">
              <el-select
                v-model="statusDrawerCp.data.signStatus"
                placeholder="请选择签约状态"
              >
                <el-option
                  :label="item.name"
                  :value="item.value"
                  v-for="item in $store.state.SIGN.STATUS.list"
                  :key="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="rSubmitStatusForm"
                >提交</el-button
              >
            </el-form-item>
          </el-form>
        </el-col>
      </el-row>
    </el-drawer>
    <!-- wishDrawerCp -->
    <el-drawer
      :title="wishDrawerCp.config.title"
      :visible.sync="wishDrawerCp.config.visible"
      :direction="wishDrawerCp.config.direction"
    >
      <el-row class="f-wish">
        <el-col :span="8" :offset="8">
          <el-form ref="wish" label-width="80px">
            <el-form-item label="签约意愿">
              <el-select
                v-model="wishDrawerCp.data.signWish"
                placeholder="请选择意愿"
              >
                <el-option
                  :label="item.name"
                  :value="item.value"
                  v-for="item in $store.state.SIGN.WISH.list"
                  :key="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="rSubmitWishForm"
                >提交</el-button
              >
            </el-form-item>
          </el-form>
        </el-col>
      </el-row>
    </el-drawer>
    <!-- bindAgentDrawerCp -->
    <el-drawer
      :title="bindAgentDrawerCp.config.title"
      :visible.sync="bindAgentDrawerCp.config.visible"
      :direction="bindAgentDrawerCp.config.direction"
      :size="bindAgentDrawerCp.config.size"
      :close="rCloseBindAgentDrawerCp"
    >
      <div class="f-agent">
        <div class="c-content">
          <el-row class="">
            <el-col :span="14" :offset="5">
              <el-form ref="agent" label-width="80px" :inline="true">
                <el-form-item label="搜索运营">
                  <el-input
                    v-model="bindAgentDrawerCp.data.searchStr"
                    placeholder="请输入运营昵称/微信号搜索"
                  ></el-input>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="rSubmitAgentSearchForm"
                    >提交</el-button
                  >
                </el-form-item>
              </el-form>
              <div class="c-main">
                <el-table :data="agentSearchAjax.data" style="width: 100%">
                  <el-table-column width="55">
                    <template slot-scope="scope">
                      <el-radio
                        :label="scope.row.userId"
                        v-model="bindAgentDrawerCp.data.agentId"
                        >&nbsp;</el-radio
                      >
                    </template>
                  </el-table-column>
                  <el-table-column label="头像">
                    <template slot-scope="scope">
                      <img class="c-avatar" :src="scope.row.avatarUrl" alt="" />
                    </template>
                  </el-table-column>
                  <el-table-column label="昵称">
                    <template slot-scope="scope">
                      <div class="">
                        {{ scope.row.nickName || "无" }}
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="姓名">
                    <template slot-scope="scope">
                      <div class="">
                        {{ scope.row.realName || "无" }}
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="部门">
                    <template slot-scope="scope">
                      <div class="">
                        {{ scope.row.departmentName || "无" }}
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="平台">
                    <template slot-scope="scope">
                      <div class="">
                        {{ scope.row.platformName || "无" }}
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="微信号">
                    <template slot-scope="scope">
                      <div class="">
                        {{ scope.row.wxNo || "无" }}
                      </div>
                    </template>
                  </el-table-column>
                </el-table>
                <div class="tc mt20">
                  <el-button type="primary" @click="rBindAgent">绑定</el-button>
                </div>
              </div>
            </el-col>
          </el-row>
        </div>
        <div class="c-content">
          <el-row class="">
            <el-col :span="14" :offset="5">
              <div class="c-main">
                <el-card
                  class="c-card"
                  v-if="agentSearchCp.data && agentSearchCp.data.length"
                >
                  <div
                    class="c-item"
                    v-for="item in agentSearchCp.data"
                    :key="item.id"
                  >
                    <div class="c-UserInfo">
                      <div class="c-avatar">
                        <img :src="item.avatarUrl" alt="" />
                      </div>
                      <div class="c-nameInfo">
                        <p class="c-name">{{ item.nickName }}</p>
                        <p class="c-station">{{ item.platformName }}</p>
                      </div>
                      <!-- <div class="c-copyBtn">
                      复制微信
                    </div> -->
                    </div>
                  </div>
                </el-card>
                <div class="p20 tc" v-else>
                  没有任何数据
                </div>
              </div>
            </el-col>
          </el-row>
        </div>
      </div>
    </el-drawer>
  </div>
</template>
<script>
import {
  getActorList,
  deleteActor,
  changeActorWish,
  changeActorStatus,
  getActorRecord,
  addActorRecord,
  bindAgent
} from "@/api/actor.js";
import { getAgentList, getViewRecords } from "@/api/user.js";
import { mixin } from "@/components/mixin/getSalaryStr.js";
import _ from "lodash";

export default {
  name: "seestar_potentialList",
  mixins: [mixin],
  data: () => ({
    pageAjax: {
      btnDisabled: false,
      btnLoading: false,
      loading: false,
      lock: false,
      paging: {
        pages: 1, // 总页数
        current: 0, // 当前页
        total: 1, // 总数量
        pageSize: 10 // 每页数量
      },
      data: []
    },
    recordAjax: {
      loading: false,
      lock: false,
      paging: {
        pages: 1, // 总页数
        current: 0, // 当前页
        total: 1, // 总数量
        pageSize: 10 // 每页数量
      },
      data: []
    },
    agentSearchAjax: {
      loading: false,
      lock: false,
      paging: {
        pages: 1, // 总页数
        current: 0, // 当前页
        total: 1, // 总数量
        pageSize: 10 // 每页数量
      },
      data: []
    },
    orgSupAjax: {
      loading: false,
      data: [],
      orginData: []
    },
    alone: {
      searchForm: {
        loading: false,
        data: {
          searchStr: "",
          signWish: "",
          platform: "",
          relType: 0
        }
      },
      signStatus: "POTENTIAL"
    },
    orgCascaderCp: {
      config: {
        props: {
          value: "id",
          label: "name",
          checkStrictly: true,
          emitPath: false
        }
      }
    },
    pageView: {
      list: [],
      current: 0,
      pageSize: 10,
      pageNo: 1,
      total: 0,
      visible: false
    },
    recordDrawerCp: {
      loading: false,
      config: {
        title: "",
        visible: false,
        direction: "ttb",
        size: "75%"
      },
      data: {
        anchorId: ""
      }
    },
    statusDrawerCp: {
      loading: false,
      config: {
        title: "",
        visible: false,
        direction: "ttb",
        size: "20%"
      },
      data: {
        signStatus: "",
        anchorId: ""
      }
    },
    wishDrawerCp: {
      loading: false,
      config: {
        title: "",
        visible: false,
        direction: "ttb",
        size: "20%"
      },
      data: {
        signWish: "",
        anchorId: ""
      }
    },
    bindAgentDrawerCp: {
      loading: false,
      config: {
        title: "",
        visible: false,
        direction: "ttb",
        size: "75%"
      },
      data: {
        searchStr: "",
        agentId: ""
      }
    },
    agentSearchCp: {
      loading: false,
      config: {
        title: "",
        visible: false,
        direction: "ttb",
        size: "20%"
      },
      data: []
    }
  }),
  created() {
    let _that = this;
    _that.getPageData();
    _that.getOrgData();
  },

  methods: {
    getPageViewData(page) {
      if (page) {
        this.pageView.pageNo = page;
      }

      getViewRecords({
        params: {
          anchorId: this.pageView.anchorId,
          pageNo: this.pageView.pageNo,
          pageSize: this.pageView.pageSize
        }
      }).then(res => {
        this.pageView.visible = true;
        this.pageView.list = res.data.data.list;
        this.pageView.total = res.data.data.pagination.total;
      });
    },
    getPageView(row) {
      this.pageView = {
        list: [],
        anchorId: row.anchorId,
        current: 0,
        pageSize: 10,
        pageNo: 1,
        total: 0,
        visible: true
      };
      this.getPageViewData();
    },
    rSubmitSearchForm() {
      let _that = this;
      let searchForm = _that.alone.searchForm;
      if (searchForm.loading) {
        return;
      }
      _that.alone.searchForm.loading = true;
      // if (!searchForm.data.searchStr && !searchForm.data.signWish && !searchForm.data.platform) {
      //   _that.$message.error({message: "搜索条件不能都为空", onClose: () => {
      //     _that.alone.searchForm.loading = false;
      //   }});
      //   return;
      // }
      _that.pageAjax.lock = false;
      _that.pageAjax.paging.current = 0;
      _that.getPageData();
    },
    rPagingChange(e) {
      let _that = this;
      _that.pageAjax.paging.current = e - 1;
      _that.getPageData();
    },
    rRecord(anchorId) {
      let _that = this;
      _that.recordDrawerCp.config.visible = true;
      _that.recordDrawerCp.data.anchorId = anchorId;

      _that.recordAjax.lock = false;
      _that.recordAjax.paging.current = 0;
      _that.getRecordData();
    },
    rSubmitRecordForm() {
      let _that = this;
      let anchorId = _that.recordDrawerCp.data.anchorId;
      let record = _that.recordDrawerCp.data.record;
      if (!record || _that.recordDrawerCp.loading) {
        return;
      }

      _that.recordDrawerCp.loading = true;
      addActorRecord({ anchorId: anchorId, followUp: record })
        .then(resp => {
          let respData = resp.data || {};

          if (respData.code === _that.STATUS.success[0]) {
            _that.$message.success(respData.msg || "修改成功");
            _that.recordDrawerCp.data.record = "";
            //_that.pageAjax.paging.current = _that.pageAjax.paging.current > 0 ? _that.pageAjax.paging.current -1 : 0;
            _that.getRecordData();
          } else {
            _that.$message.error(respData.msg || "修改失败");
          }
        })
        .finally(() => {
          _that.recordDrawerCp.loading = false;
        });
    },
    rChangeStatus(anchorId, signStatus) {
      let _that = this;

      _that.statusDrawerCp.config.visible = true;
      _that.statusDrawerCp.data.anchorId = anchorId;
      _that.statusDrawerCp.data.signStatus = signStatus;
      _that.alone.originSignStatus = signStatus;
    },
    rSubmitStatusForm() {
      let _that = this;
      let signStatus = _that.statusDrawerCp.data.signStatus;
      let anchorId = _that.statusDrawerCp.data.anchorId;
      let originSignStatus = _that.alone.oRiginSignStatus;
      if (!signStatus || _that.statusDrawerCp.loading) {
        return;
      }
      // 不能直接开播，而是必须先试播
      if (signStatus === "SIGNED" && originSignStatus !== "SIGNING") {
        _that.$message.error("请先更改为试播状态");
        return;
      }

      if (signStatus === "SIGNING") {
        _that.bindAgentDrawerCp.config.visible = true;
        _that.statusDrawerCp.config.visible = false;
        return;
        //_that.agentSearchCp.data.anchorId = anchorId;
      }
      _that.statusDrawerCp.loading = true;
      changeActorStatus({ anchorId: anchorId, signStatus: signStatus })
        .then(resp => {
          let respData = resp.data || {};

          if (respData.code === _that.STATUS.success[0]) {
            _that.$message.success(respData.msg || "修改成功");
            _that.statusDrawerCp.config.visible = false;
            _that.pageAjax.paging.current =
              _that.pageAjax.paging.current > 0
                ? _that.pageAjax.paging.current - 1
                : 0;
            _that.getPageData();
          } else {
            _that.$message.error(respData.msg || "修改失败");
          }
        })
        .finally(() => {
          _that.statusDrawerCp.loading = false;
        });
    },
    rChangeWish(anchorId, signWish) {
      let _that = this;

      _that.wishDrawerCp.config.visible = true;
      _that.wishDrawerCp.data.anchorId = anchorId;
      _that.wishDrawerCp.data.signWish = signWish;
    },
    rSubmitWishForm() {
      let _that = this;
      let signWish = _that.wishDrawerCp.data.signWish;
      let anchorId = _that.wishDrawerCp.data.anchorId;
      if (!signWish || _that.wishDrawerCp.loading) {
        return;
      }

      _that.wishDrawerCp.loading = true;
      changeActorWish({ anchorId: anchorId, signWish: signWish })
        .then(resp => {
          let respData = resp.data || {};

          if (respData.code === _that.STATUS.success[0]) {
            _that.$message.success(respData.msg || "修改成功");
            _that.wishDrawerCp.config.visible = false;
            _that.pageAjax.paging.current =
              _that.pageAjax.paging.current > 0
                ? _that.pageAjax.paging.current - 1
                : 0;
            _that.getPageData();
          } else {
            _that.$message.error(respData.msg || "修改失败");
          }
        })
        .finally(() => {
          _that.wishDrawerCp.loading = false;
        });
    },
    rSubmitAgentSearchForm() {
      let _that = this;
      let searchStr = _that.bindAgentDrawerCp.data.searchStr;
      if (!searchStr) {
        _that.$message.error("搜索条件不能为空");
        return;
      }
      _that.bindAgentDrawerCp.data.anchorId = "";
      _that.getAgentData();
    },
    rBindAgent() {
      let _that = this;
      let agentId = _that.bindAgentDrawerCp.data.agentId;
      let anchorId = _that.statusDrawerCp.data.anchorId;

      if (_that.bindAgentDrawerCp.loading) {
        return;
      }
      if (!agentId) {
        _that.$message.error("请选择要绑定的运营");
        return;
      }

      _that.bindAgentDrawerCp.loading = true;
      bindAgent({ anchorId: anchorId, operatorId: agentId })
        .then(resp => {
          let respData = resp.data || {};

          if (respData.code === _that.STATUS.success[0]) {
            _that.$message.success(respData.msg || "修改成功");
            _that.bindAgentDrawerCp.config.visible = false;
            _that.bindAgentDrawerCp.data.agentId = "";
            _that.bindAgentDrawerCp.data.searchStr = "";

            _that.pageAjax.paging.current =
              _that.pageAjax.paging.current > 0
                ? _that.pageAjax.paging.current - 1
                : 0;
            _that.getPageData();
          } else {
            _that.$message.error(respData.msg || "修改失败");
          }
        })
        .finally(() => {
          _that.bindAgentDrawerCp.loading = false;
        });
    },
    rCloseBindAgentDrawerCp() {
      let _that = this;
      _that.bindAgentDrawerCp.data.agentId = "";
    },

    rDeleteActor(id) {
      let _that = this;
      this.$confirm("你确定要删除此数据?", "删除提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          deleteActor({ anchorId: id }).then(resp => {
            let respData = resp.data || {};

            if (respData.code === _that.STATUS.success[0]) {
              _that.$message.success(respData.msg || "删除成功");
              _that.pageAjax.paging.current =
                _that.pageAjax.paging.current > 0
                  ? _that.pageAjax.paging.current - 1
                  : 0;
              _that.getPageData();
            } else {
              _that.$message.error(respData.msg || "删除失败");
            }
          });
        })
        .catch(() => {});
    },
    getPageData() {
      let _that = this;
      let searchForm = _.cloneDeep(_that.alone.searchForm);
      let pageAjax = _that.pageAjax;

      if (pageAjax.loading || pageAjax.lock) {
        return;
      }

      let data = { ...searchForm.data };
      data.signStatus = _that.alone.signStatus;
      data.pageNo = _that.pageAjax.paging.current + 1;
      _that.pageAjax.loading = true;
      getActorList({ params: data })
        .then(resp => {
          let respData = resp.data || {};

          if (respData.code === _that.STATUS.success[0]) {
            _that.pageAjax.data = respData.data.list;
            _that.pageAjax.paging = {
              pages: respData.data.pagination.pages,
              current: respData.data.pagination.current,
              total: respData.data.pagination.total,
              pageSize: respData.data.pagination.pageSize
            };
          } else {
            _that.$message.error(respData.msg || "获取失败");
          }
        })
        .finally(() => {
          _that.pageAjax.loading = false;
          _that.alone.searchForm.loading = false;
        });
    },
    getOrgData() {
      let _that = this;
      return _that.$store.dispatch("getPlatformList").then(() => {
        let arr =
          _.cloneDeep(
            _that.$store.getters.wantPlatformListOffspringnTreeData(2)
          ) || [];
        // arr.unshift({ id: "", name: "全部" });
        _that.orgSupAjax.data = arr;
      });
    },
    getAgentData() {
      let _that = this;
      let searchStr = _that.bindAgentDrawerCp.data.searchStr;

      if (_that.agentSearchAjax.loading) {
        return;
      }

      _that.agentSearchAjax.loading = true;
      getAgentList({ params: { searchStr: searchStr } })
        .then(resp => {
          let respData = resp.data || {};

          if (respData.code === _that.STATUS.success[0]) {
            _that.agentSearchAjax.data = respData.data;
          } else {
            _that.$message.error(respData.msg || "获取失败");
          }
        })
        .finally(() => {
          _that.agentSearchAjax.loading = false;
        });
    },
    getRecordData() {
      let _that = this;
      let recordAjax = _that.recordAjax;
      let anchorId = _that.recordDrawerCp.data.anchorId;

      if (recordAjax.loading || recordAjax.lock) {
        return;
      }

      let pageNo = _that.recordAjax.paging.current + 1;
      _that.recordAjax.loading = true;
      getActorRecord({ params: { anchorId: anchorId, pageNo: pageNo } })
        .then(resp => {
          let respData = resp.data || {};

          if (respData.code === _that.STATUS.success[0]) {
            _that.recordAjax.data = respData.data;
            _that.recordAjax.paging = {
              // pages: respData.data.pagination.pages,
              // current: respData.data.pagination.current,
              // total: respData.data.pagination.total,
              // pageSize: respData.data.pagination.pageSize,
            };
          } else {
            _that.$message.error(respData.msg || "获取失败");
          }
        })
        .finally(() => {
          _that.recordAjax.loading = false;
        });
    },
    split(str) {
      if (!str) {
        return [];
      }
      let arr = str.split("|");
      return arr;
    },
    rToUrl() {
      this.$router.push({ name: "seestar_create" });
    },
    navToEdit(id) {
      this.$router.push({
        name: "seestar_edit",
        query: {
          anchorId: id
        }
      });
    },
    navToDetail(id) {
      this.$router.push({
        name: "seestar_detail",
        query: {
          anchorId: id
        }
      });
    }
  }
};
</script>
<style lang="scss" scoped>
.page {
  .s-search {
    border-bottom: 1px solid #eee;
  }
  .c-aside {
    .btn {
      margin-right: 20px;
    }
    .diy-uploadBtn {
      margin-right: 20px;
    }
  }
  .c-main {
    margin-top: 20px;
    .c-avatar {
      display: block;
      width: 100px;
      height: 100px;
      border-radius: 50%;
    }
  }
  .c-pagination {
    margin-top: 20px;
    text-align: center;
  }
  .f-record {
    overflow: hidden;
    position: absolute;
    width: 100%;
    left: 0;
    top: 50px;
    bottom: 0;
    .c-content {
      height: 100%;
      padding-bottom: 20px;
      overflow: auto;
    }
  }

  .f-agent {
    overflow: hidden;
    position: absolute;
    width: 100%;
    left: 0;
    top: 0;
    bottom: 0;
    .c-content {
      height: 100%;
      padding-bottom: 20px;
      padding-top: 60px;
      overflow: auto;
    }
    .c-avatar {
      width: 80px;
      height: 80px;
    }
  }
}
</style>
